<?php
$player = $game->player_get_uinfo();

if (isset($_POST['canshu'])){
    $canshu = $_POST['canshu'];
    if($canshu == 'guashou'){
        //$game->zb_update_user_sid( $zbnowid , "");
    }

}

$zhuangbei = $game->zb_get_info($arr_data->zbnowid);

$arr = array($player->tool1,$player->tool2,$player->tool3,$player->tool4,$player->tool5,$player->tool6);
$强化需要游戏币 = round($zhuangbei->qianghua/2) * round($zhuangbei->qianghua/3) * 2 * (round($zhuangbei->qianghua / 4) )+ 1;
$强化道具数量 = '';
$链接_穿戴装备 = '';
$链接_强化攻击 = '';
$链接_强化防御 = '';
$链接_强化气血 = '';
$链接_分解装备 = '';

$upxx = '';
$装备操作提示 = '';
$qhssum = '';

$game_zb1 = $game->get_system_config("游戏","装备1");
$game_zb2 = $game->get_system_config("游戏","装备2");
$game_zb3 = $game->get_system_config("游戏","装备3");
$game_zb4 = $game->get_system_config("游戏","装备4");
$game_zb5 = $game->get_system_config("游戏","装备5");
$game_zb6 = $game->get_system_config("游戏","装备6");
$qhdjid = $game->get_system_config("游戏","强化道具");
$qhdaoju = $game->dj_get_sys($qhdjid);

if (isset($_POST['cmd2'])){
    $cmd2 = $_POST['cmd2'];
};

if ($player->uid == $zhuangbei->uid){
    switch ($arr_data->cmd2){
        case 'upzb':
            if ($player->uyxb < $强化需要游戏币){
                $装备操作提示 = "强化失败，灵石不足<br/>";
                break;
            }

            $ret = $game->zb_sx_up($arr_data->zbnowid,$arr_data->zbsx);
            if ($ret != -1){

                $retyxb = $game->yxb_change(2,$强化需要游戏币);
                if ( $ret == 1){
                    $装备操作提示 = "恭喜强化成功<br/>";
                }elseif ( $ret == 0){
                    $装备操作提示 = "强化失败，请攒积人品<br/>";
                }

                $zhuangbei = $game->zb_get_info_player($arr_data->zbnowid);
            }else{
                $装备操作提示 = "强化失败，强化石不足<br/>";
            }
            break;
    }

    $链接_强化攻击 =  $game->create_url("cmd=zbinfo&cmd2=upzb&zbsx=zbgj&zbnowid=$zhuangbei->zbnowid","强化攻击");
    $链接_强化防御 =  $game->create_url("cmd=zbinfo&cmd2=upzb&zbsx=zbfy&zbnowid=$zhuangbei->zbnowid","强化防御");
    $链接_强化气血 =  $game->create_url("cmd=zbinfo&cmd2=upzb&zbsx=zbhp&zbnowid=$zhuangbei->zbnowid","强化气血");

    $daoju = $game->dj_get_player($qhdjid);
    if (!$daoju){
        $daoju = (object)[
            "djsum"=> 0
        ];
    }
    $强化道具数量 = $daoju->djsum;

//    $upbj ="<a href='$upbj'>强化暴击</a>";
//    $upxx ="<a href='$upxx'>强化吸血</a>";
}else{
    $uyxb='';
}

if ($player->uid == $zhuangbei->uid && !in_array($zhuangbei->zbnowid,$arr)){

    $player = $game->player_get_uinfo();
    $链接_分解装备 =  $game->create_url("cmd=zbinfo&cmd2=delezb&zbnowid=$zhuangbei->zbnowid","分解装备");
    $链接_穿戴装备 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool={$zhuangbei->zbtool}&zbid=$zhuangbei->zbnowid","穿戴装备");

    if ($zhuangbei->zbtool == 0){
        $setzbwz1 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool=1&zbid=$zhuangbei->zbnowid","装备在【{$game_zb1}】位置");
        $setzbwz2 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool=2&zbid=$zhuangbei->zbnowid","装备在【{$game_zb2}】位置");
        $setzbwz3 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool=3&zbid=$zhuangbei->zbnowid","装备在【{$game_zb3}】位置");
        $setzbwz4 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool=4&zbid=$zhuangbei->zbnowid","装备在【{$game_zb4}】位置");
        $setzbwz5 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool=5&zbid=$zhuangbei->zbnowid","装备在【{$game_zb5}】位置");
        $setzbwz6 =  $game->create_url("cmd=zhuangtai&cmd2=setzb&tool=6&zbid=$zhuangbei->zbnowid","装备在【{$game_zb6}】位置");

        $链接_穿戴装备 = "{$setzbwz1}{$setzbwz2}<br/>{$setzbwz3}{$setzbwz4}<br/>{$setzbwz5}{$setzbwz6}<br/>";
    }

//    <br/>
//    <form method='post'>
//    <input type='hidden' name='c' value='$cc'>
//    <input type='hidden' name='canshu' value='guashou'>
//    <input type='hidden' name='zbnowid' value='$zhuangbei->zbnowid'>
//    挂售单价：<br/>
//    <input type='number' name='pay'>
//    <input type='submit' value='挂售'>
//    </form>";
}
$强化需要道具数量 = $zhuangbei->qianghua * $zhuangbei->qianghua + $zhuangbei->qianghua +  1;
$强化需要游戏币 = round($zhuangbei->qianghua/2) * round($zhuangbei->qianghua/3) * 2 * (round($zhuangbei->qianghua / 4) )+ 1;
$分解所需游戏币 = $zhuangbei->qianghua * 20 + 20;

$强化成功率 = $zhuangbei->qianghua * $zhuangbei->qianghua - $zhuangbei->qianghua;
$强化成功率 = ($zhuangbei->qianghua + 1) /($强化成功率 + 1)  * 100;

//round((30- $zhuangbei->qianghua)/30,2) * 100;
$tools = array("不限定" , $game_zb1 , $game_zb2 , $game_zb3 , $game_zb4 , $game_zb5 , $game_zb6);
$装备位置 = $tools[$zhuangbei->zbtool];

$变量_装备信息 = (object)array(
    "装备位置"=>$装备位置,
    "链接_强化攻击"=>$链接_强化攻击,
    "链接_强化防御"=>$链接_强化防御,
    "链接_强化气血"=>$链接_强化气血,
    "链接_穿戴装备"=>$链接_穿戴装备,
    "链接_分解装备"=>$链接_分解装备,
    "强化成功率"=>"{$强化成功率}%",
    "装备操作提示"=>$装备操作提示,
    "分解所需游戏币"=>$分解所需游戏币,
    "强化需要游戏币"=>$强化需要游戏币,
    "强化道具数量"=>$强化道具数量,
    "强化需要道具数量"=>$强化需要道具数量
);

$dis_mid = $game->dis_get('排版_装备信息');
eval("\$out_html = \"$dis_mid->dis_string\";");
$out_html = str_replace("<br/><br/>", "<br/>",$out_html);
$out_html = str_replace("<br/><br/>", "<br/>",$out_html);
$out_html = str_replace("</div><br/>", "</div>",$out_html);
echo $out_html;
?>